struct Object
{
    /* data */
};


struct Stack
{
    Object** data;
    int maxSize;
    int size;
    int start;
    int end;
};

//清空队列
void deleteStack(Stack* s)
{
    for(int i=0;i<s->size;i++)
    {
        delete s->data[i];
    }
    delete s->data;
    delete s;
}


Stack* newStack(int maxSize){
    Stack* stack=new Stack;
    stack->maxSize=maxSize;
    stack->data=new Object*[maxSize];
    stack->size=0;
    stack->start=0;
    stack->end=-1;
    return stack;
}

//入栈
void pushStack(Stack* s, Object* item)
{
    s->end++;
    s->data[s->end]=item;
    s->size++;
}

//出栈
Object* popStack(Stack* s){
    if(s->end<0)
    {
        return NULL;
    }
    else{
        Object* end=s->data[s->end];
        s->end=NULL;
        s->end--;
        s->size--;
        return end;
    }
}

//栈元素多少
int sizeOfStack(Stack* s)
{
    return s->size;
}

//栈是否为空
int isEmpStack(Stack* s)
{
    return s->size<=0;
}


